package drds.data_migrate;


import drds.common.Author;
import drds.common.Xmls;
import drds.data_migrate.job.JobContainer;
import drds.data_migrate.vo.JobConfig;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;

/**
 * 只支持同表结构-细微差异的表结构迁移,该框架主要用于drds内部分片表之前的互相迁移.
 */
@Author(name = Authors.LI_YANG)
@Slf4j
public class DataExchangeService
{


    public static void main(String[] args) throws Exception
    {


        dataExchange("xx");
    }

    /**
     * 首先需要解决一个问题,该jar被多个服务器共同使用,一个jvm或者说model中不能共享
     */
    public static void dataExchange(@NonNull String string) throws Exception
    {


        JobConfig jobConfig = new JobConfig();
        //
        String s = Xmls.convertToXml(jobConfig);
        log.info("输入参数:" + string);
        jobConfig = Xmls.converyToJavaBean(s, JobConfig.class);
        DataExchangeService dataExchangeService = new DataExchangeService();
        dataExchangeService.run(jobConfig);
    }

    public void run(JobConfig jobConfig)
    {
        JobContainer jobContainer = new JobContainer(jobConfig);
        jobContainer.run();

    }

}
